const mock = require('mockjs')
var Random = mock.Random
function getQuestionList(ctx) {
    const { pageSize = 10, page = 1, isDelete = false, isStart = false } = ctx.query
    const ArrayList = []
    for (let i = 0; i < pageSize; i++) {
        const obj = {
            id: Random.id(),
            title: Random.ctitle(),
            isPublished: Random.boolean(),
            isStart: Random.boolean(),
            isDelete: false,
            answerCount: Random.natural(50, 100),
            createTime: Random.date('yyyy-MM-dd HH:mm:ss')
        }
        if (isDelete) {
            obj.isDelete = true
        }
        if (isStart) {
            obj.isStart = true
        }
        ArrayList.push(obj)
    }
    return ArrayList
}

module.exports = getQuestionList
